

package com.hazelcast.internal.config;

import com.hazelcast.config.DataConnectionConfig;

import javax.annotation.Nonnull;
import java.util.Properties;

public class DataConnectionConfigReadOnly extends DataConnectionConfig {

    public DataConnectionConfigReadOnly(DataConnectionConfig config) {
        super(config);
    }

    @Override
    public DataConnectionConfig setName(String name) {
        throw readOnly();
    }

    private RuntimeException readOnly() {
        return new UnsupportedOperationException("Config '" + getName() + "' is read-only");
    }

    @Override
    public DataConnectionConfig setType(@Nonnull String type) {
        throw readOnly();
    }

    @Override
    public DataConnectionConfig setShared(boolean shared) {
        throw readOnly();
    }

    @Override
    public DataConnectionConfig setProperties(Properties properties) {
        throw readOnly();
    }

    @Override
    public DataConnectionConfig setProperty(String key, String value) {
        throw readOnly();
    }
}
